package face.pay.web.quota;

import face.pay.common.quota.service.IQuotaApplyService;
import face.pay.entity.AgencyQuotaApply;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.ResultMessage;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: zkj
 * @Date: 2019/7/18 14:32
 * @Description:
 */
@Controller
@RequestMapping("/quota_apply_oem")
public class OemQuotaApplyController {

    @Autowired
    private IQuotaApplyService iAgencyQuotaApplyService;

    /**
     * OEM 申请记录
     * @return
     */
    @RequestMapping(value = "/list")
    public String oem_mamager(){

        return  "quota/apply_oem_list";

    }

    /**
     * 查询当前Oem 所有购买申请
     * @param agencyQuotaApply
     * @param pageParam
     * @param loginUser
     * @return
     */
    @RequestMapping(value = "/queryData")
    @ResponseBody
    public PageData queryData(AgencyQuotaApply agencyQuotaApply, PageParam pageParam, @CurrentUser UserInfo loginUser){

        agencyQuotaApply.setOemId(loginUser.getOemId());

        return  iAgencyQuotaApplyService.queryList(agencyQuotaApply,pageParam);
    }


    /**
     * 订单处理
     * @param agencyQuotaApply
     * @param loginUser
     * @return
     */
    @RequestMapping(value = "/apply_handle")
    @ResponseBody
    public ResultMessage apply_handle(AgencyQuotaApply agencyQuotaApply,  @CurrentUser UserInfo loginUser){

        agencyQuotaApply.setOemId(loginUser.getOemId());

        return  iAgencyQuotaApplyService.applyHandle(agencyQuotaApply,loginUser);
    }


    @RequestMapping(value = "/add_quota")
    @ResponseBody
    public ResultMessage addQuota(AgencyQuotaApply agencyQuotaApply,  @CurrentUser UserInfo loginUser){
        return  iAgencyQuotaApplyService.addQuota(agencyQuotaApply,loginUser);
    }








}
